package com.yanghx.user.server.vo;

import com.yanghx.user.server.enums.ResultEnum;
import lombok.Data;

/**
 * @author yangHX
 * createTime  2019/9/14 21:07
 */
@Data
public class ResultVO<T> {

    private Integer code;

    private String msg;

    private T data;

    public static ResultVO error(ResultEnum resultEnum) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(resultEnum.getCode());
        resultVO.setMsg(resultEnum.getMessage());
        return resultVO;
    }

    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(0);
        resultVO.setMsg("成功");
        return resultVO;
    }
}
